package com.itheima.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author Encounter
 * @date 2024/10/05 13:14<br/>
 */
@Mapper
public interface SetmealCheckGroupMapper
    {
        /**
         * 找到检查群IDS由套餐id
         *
         * @param setmealId 套餐id
         * @return {@link List }<{@link Integer }>
         */
        @Select("select checkgroup_id from t_setmeal_checkgroup where setmeal_id = #{setmealId}")
        List<Integer> findCheckGroupIdsBySetmealId(Integer setmealId);
        
        /**
         * 删除由套餐id
         *
         * @param setmealId id
         */
        @Delete("delete from t_setmeal_checkgroup where setmeal_id = #{setmealId}")
        void deleteBySetmealId(Integer setmealId);
        
        /**
         * 插入
         *
         * @param map 插入的数据
         */
        @Insert("insert into t_setmeal_checkgroup(setmeal_id, checkgroup_id) " +
                "values (#{setmealId},#{checkGroupId})")
        void insert(Map<String, Integer> map);
    }
